<?php echo $this->element('menu'); ?>
<div id='send-message'>	
	<div class="container">
		<div class="panel-group" id="accordion">
		
		  <div class="panel panel-default">
		    <div class="panel-heading">
		      <h4 class="panel-title">
		        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
		          <?php 
		          	echo $toUser['Profile']['name']; 
		          	
		          ?>
		        </a>
		      </h4>
		    </div>
		    <div id="collapseOne" class="panel-collapse collapse in">
		      <div class="panel-body">
		        <?php
		        	foreach($userMessages as $message){
		        		if($message['UserMessage']['from_user_id'] == $toUser['User']['id']){
		        ?>
		        			<p style="color:blue; text-align:left"><?php echo $message['UserMessage']['message']; ?>
		        			</p>
		        			<hr>
				<?php
		        		}else{
		        ?>
		        			<p style="color:black; text-align:right"><?php echo $message['UserMessage']['message']; ?>
		        			</p>
		        			<hr>
		        <?php
		        		}
		        	}
		        	echo $this->Form->create('UserMessage', array(
		        											'action'=>'/sendMessage/'.$toUser['User']['id']));
					echo $this->Form->input('UserMessage.message');
					echo $this->Form->input('UserMessage.created', array('type'=>'hidden'));
					echo $this->Form->end();
		        ?>

		      </div>
		    </div>
		  </div>

		</div>
	</div>
</div>